<?php

namespace App\Models\common;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * 字典实例列表
 */
class SysMap extends Model
{
    use HasFactory;

    protected $table = 'admin_sys_map';

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'map_code',
        'parent_val',
        'map_name',
        'map_val',
        'map_val2',
        'map_val3',
        'sort',
        'map_desc',
    ];

    /**
     * 为 array / JSON 序列化准备日期格式
     */
    protected function serializeDate(DateTimeInterface $date): string
    {
        return $date->format('Y-m-d H:i:s');
    }
}
